#include<stdio.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
#include <stdlib.h>
#include <unistd.h>
#include<string.h>
int main(int argc,char **argv)
{
    int fd;
    fd = open(argv[1],O_RDWR);
    if(fd == -1)
    {
        perror("open file error!");
        exit(1);
    }
    char buf[]="hello world";
    int ret = write(fd,buf,strlen(buf));
    if(ret == -1)
    {
        perror("file write error\n");
    }
    memset(buf,0,strlen(buf));
    lseek(fd,0,SEEK_SET);
    ret = read(fd,buf,5);
    if(ret == -1)
    {
        perror("read error");
    }
    printf("read:%s",buf);
    close(fd);
    return 0;
}